function [TX_OUT_Filtered Input_Bits_Actual,OUT_Bits_Interleaved,N_Frames,TX_OUT] = HF_TRANSMITER(Input_Bits,Rate,Interleaver_L,N_Initial_Preamble,alpha,Oversample,HF_SRRC,modulationIndex)


global trellis_t
%*-------------------------------------- BLOCKING --------------------------------------------------%

[M_OUT_Blocks N_Blocks] = HF_Blocking(Input_Bits,Rate,Interleaver_L);  % put the data into blocks
Input_Bits_Actual=reshape(M_OUT_Blocks.',1,[]);
%*------------------------------------ BLOCK PROCESSING --------------------------------------------%
% we have two processes made on the block level (Encoding) and (Interleaving)

Frame_Count = 1;
for block_index = 1:N_Blocks
    OUT_Bits_Encoded(block_index,:) = HF_Convenc_Tailbiting_K7_Punct_R43(M_OUT_Blocks(block_index,:),trellis_t);%#ok
    OUT_Bits_Interleaved(Frame_Count:Frame_Count+Interleaver_L-1,:) = HF_Interleaving(OUT_Bits_Encoded(block_index,:),Rate,Interleaver_L);
    Frame_Count = Frame_Count+Interleaver_L;
end
N_Frames = Frame_Count-1;
%*----------------------------------------------------------------------------------------------------%

%*------------------------------------ FRAME PROCESSING ----------------------------------------------%
% we have two processes made on the frame level (Scrambling) and (Modulation)

for frame_index = 1:N_Frames
    OUT_Symbols(frame_index,:) = HF_Scrambling( OUT_Bits_Interleaved(frame_index,:),Rate);%#ok
    Modulated_Data(frame_index,:) = HF_Modulate(OUT_Symbols(frame_index,:),Rate);%#ok
end
%*----------------------------------------------------------------------------------------------------%

%*----------------------------------------- FRAMMINGH ------------------------------------------------%

TX_OUT = 1*HF_Framming(Modulated_Data,Rate,Interleaver_L,N_Frames,N_Initial_Preamble);
%*----------------------------------------------------------------------------------------------------%

% Oversample the Tx data by the sampling rate (as it is analog and sampled by this rate)
%-----------------------------------------------------------------------------------------------
TX_OUT_Oversampled = upsample(TX_OUT,Oversample);

% Filtering the Tx output data
%-------------------------------
TX_OUT_Filtered = conv(TX_OUT_Oversampled,HF_SRRC);

% get the average power to normalize
%----------------------------------------
TX_OUT_Avg_Power = TX_OUT_Filtered*TX_OUT_Filtered'/length(TX_OUT_Filtered);
% average power per symbol for the transmitted symbols to devide the AWGN
% noise power on it.

%         TX_OUT_Filtered = sqrt(1/TX_OUT_Avg_Power)*TX_OUT_Filtered;
%*---------------------------------------------------------------------------------------------------%